package util;

import java.io.BufferedReader;
import java.io.FileReader;

import weka.core.Instances;

public class Utils {

	public static String getopt(String opt, String[] paras){
		  for(int i = 0; i < paras.length; ++i){
		 	if(paras[i].equals(opt))
			  return paras[i+1];
		  }	  

		  return null;	
		}
	
public static Instances getInstances(String filename) throws Exception{
		
		BufferedReader reader = new BufferedReader(new FileReader(filename));
		Instances dataset = new Instances(reader);
		dataset.setClassIndex(dataset.numAttributes() - 1);
		return dataset;
	} 
	
}
